From 992e40835af1600a0961ec2454fb78ff43aec3c6 Mon Sep 17 00:00:00 2001 From: Martin Kagamino Lehoux Date: Mon, 7 Sep 2026 22:31:23 +0200 Subject: Add routine archives: archive date, searchable archived list, frozen page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Stamp archived_at on the archived snapshot; copy it on edit - loadArchived(projectId) + collapsible fuzzy-searched "Archivées" section on the project page - Archived routine pages open read-only with the health chart ending at the archive date; edit/complete actions reject archived routines --- .../[projectId]/routine/[routineId]/+page.svelte | 186 ++++++++++++--------- 1 file changed, 106 insertions(+), 80 deletions(-) (limited to 'src/routes/projects/[projectId]/routine/[routineId]/+page.svelte') diff --git a/src/routes/projects/[projectId]/routine/[routineId]/+page.svelte b/src/routes/projects/[projectId]/routine/[routineId]/+page.svelte index d57ed79..5f57de4 100644 --- a/src/routes/projects/[projectId]/routine/[routineId]/+page.svelte +++ b/src/routes/projects/[projectId]/routine/[routineId]/+page.svelte @@ -42,8 +42,14 @@ year: 'numeric', }); + const frozenAt = $derived( + data.routine.archived + ? Date.parse(data.routine.archivedAt ?? data.routine.createdAt) + : Date.now(), + ); + const series = $derived( - computeHealthSeries(data.routine, data.completions, Date.now()), + computeHealthSeries(data.routine, data.completions, frozenAt), ); const PAD = 10; @@ -93,65 +99,76 @@ {data.state.health} -
{ - return async ({ result, update }) => { - await update({ reset: false }); - }; - }} - > - {#if form?.error} -

{form.error}

- {/if} - - - - {#if frequency !== '' && frequencyDays === null} -

Intervalle invalide — ex : 1d, 2w, 3m, 1y

- {/if} - -

✓ Enregistré

-
+ {#if form?.error} +

{form.error}

+ {/if} + + + + {#if frequency !== '' && frequencyDays === null} +

Intervalle invalide — ex : 1d, 2w, 3m, 1y

+ {/if} + +

✓ Enregistré

+ + {/if}

Santé

@@ -197,27 +214,29 @@

Historique

-
{ - return async ({ update }) => { - note = ''; - await update({ reset: false }); - }; - }} - > - - -
+ {#if !data.routine.archived} +
{ + return async ({ update }) => { + note = ''; + await update({ reset: false }); + }; + }} + > + + +
+ {/if}